#ifndef _LED_H_
#define _LED_H_

#include "common_def.h"
#include "debug_print.h"

// turn on/off
#define led_off() do {(P1OUT |= BIT4);} while (0)
#define led_on() do {(P1OUT &= ~BIT4);} while (0)

#define led_set(v) do {if (v) led_on(); else led_off();} while (0)

void led_init(void);
/* Normal state, loop:
 * 0.1s on
 * 1s off
 */
void led_state_normal(void);

/*
 * Collecting state, loop: 
 * 0.1s on 
 * 2s off 
 */
void led_state_collecting(void);

/*
 * Offline state, loop: 
 * 0.1s on 
 * 10s off 
 */
void led_state_offline(void);

/*
 * Not deployed, loop: 
 * always on 
 */
void led_state_debugging(void);

/*
 * always off
 */
void led_state_communicating(void);

/*
 * Abnormal state, loop: 
 * 0.1s on 
 * 0.3s off 
 */
void led_state_abnormal(void);

#endif // _LED_H_
